package com.zy.explore.rocketmq.application.event.subscribe;

import cn.hutool.core.date.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@EnableScheduling
@Component
public class Input5MessagePollTask {

    @Autowired
    private MessageInput messageInput;

    @Scheduled(initialDelay = 5000L,fixedRate = 5000L)
    public void poll(){
        messageInput.input5().poll(message -> System.out.println(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss") + "==>input5拉取到消息：" + new String((byte[]) message.getPayload())));
    }
}
